package tienmanh.gs.goldminer.sprite;

import org.andengine.entity.primitive.Line;
import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.opengl.texture.region.ITiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.util.math.MathUtils;

import tienmanh.gs.goldminer.scene.GameScene;

public class Thunder extends AnimatedSprite{

	Line line;
	public Thunder(float pX, float pY,
			ITiledTextureRegion pTiledTextureRegion,
			VertexBufferObjectManager pVertexBufferObjectManager , Line line , Hook hook) {
		super(pX, pY, pTiledTextureRegion, pVertexBufferObjectManager);
		// TODO Auto-generated constructor stub
		animate(new long[]{100,100,100,100}, true);
		setRotationCenter(getWidth() / 2.0F, 1.0F);
    	setRotation(hook.angle - 90.0F);
    	setWidth(40);
    	float a = line.getX2() - line.getX1();
    	float b = line.getY2() - line.getY1();
    	float d = (float) (Math.sqrt(a*a+b*b));
    	setHeight(d);
    	setPosition(pX - getWidth()/2, pY+20);
	}

}
